﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AlexandriaPressAdminDataAccessLayer;
using AlexandriaPressAdminObject;


namespace AlexandriaPressAdminBusinessLayer
{
    public class MostPopularBL
    {
        private static int endDay;
        private static DateTime DateStart;
        private static DateTime DateEnd;
    
        public static List<MostPopularObjects> popularBookList(int month, int year)
        {
            if(month == 9 || month == 4 || month == 6 || month ==11){
            endDay = 30;
            }
            else if(month == 2 && year%4==0)
            {
            endDay=29;
            }
            else if(month == 2 && year%4!=0)
            {
            endDay=28;
            }
            else
            {
            endDay=31;
            }
            DateStart=Convert.ToDateTime(month+"/01"+"/"+year);
            DateEnd=Convert.ToDateTime(month+"/"+endDay+"/"+year);

            return MostPopularDL.PopularBookList(DateStart, DateEnd);
        }

        public static List<MostPopularObjects> popularAuthorList(int month, int year)
        {


            if(month == 9 || month == 4 || month == 6 || month == 11){
            endDay = 30;
            }
            else if(month == 2 && year%4==0)
            {
            endDay=29;
            }
            else if(month == 2 && year%4!=0)
            {
            endDay=28;
            }
            else
            {
            endDay=31;
            }
            DateStart=Convert.ToDateTime(month+"/01"+"/"+year);
            DateEnd=Convert.ToDateTime(month+"/"+endDay+"/"+year);


            return MostPopularDL.PopularAuthorList(DateStart,DateEnd);
        }


    }
}
